import { useEffect } from 'react';

interface Props {
  onFullscreenChange?: () => void;
}

const RootEventListenner: React.FC<Props> = ({ onFullscreenChange }) => {
  useEffect(() => {
    const onFullscreenChangeListenner = () => {
      if (onFullscreenChange) {
        onFullscreenChange();
      }
    };
    document.addEventListener('fullscreenchange', onFullscreenChangeListenner);
    return () => {
      document.removeEventListener('fullscreenchange', onFullscreenChangeListenner);
    };
  });
  return null;
};
export default RootEventListenner;
